<?php
class Lib_Log {

	/**
	 *
	 * Enter description here ...
	 * @param poker $param
	 * @param string $file_name
	 * @param \Zend_LOG $priority
	 * @throws Exception
	 */
    public static function toFile($param, $file_name='action', $priority=Zend_Log::INFO){
        $stream = @fopen( APPLICATION_PATH."/logs/".$file_name.'.log', 'a', false);
        if (! $stream) {
            throw new Exception('Failed to open stream for logging');
        }

        $writer = new Zend_Log_Writer_Stream($stream);
        $formatter = new Zend_Log_Formatter_Simple('%timestamp% :: %priorityName% :: %message%');
        $writer->setFormatter($formatter);
        $logger = new Zend_Log($writer);

        if(is_array($param) or is_object($param))
            $logger->log(print_r($param, true)."\n", $priority);
        else
            $logger->log($param."\n", $priority);
    }

}